EasyTrack::Application.routes.draw do


  # The priority is based upon order of creation:
  # first created -> highest priority.

  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end

  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end

  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  root :to => "orders#index"
  
  resources :orders do
    member do
      get :new_order_item,
          :new_order_made,
          :new_installation,
          :new_installed,
          :new_install_unfinished,
          :new_after_serviced,
          :new_after_service_finished,
          :new_after_service_unfinished,
          :new_feed,
          :new_completed,
          :show_status,
          :new_enter,
          :new_payment,
          :edit_buyer,
          :edit_remark,
          :edit_order_item,
          :edit_installation,
          :edit_installed,
          :edit_install_unfinished,
          :edit_after_serviced,
          :edit_after_service_finished,
          :edit_after_service_unfinished,
          :edit_order_made,
          :edit_enter,
          :edit_payment,
          :edit_finance,
          :edit_completed,
          :edit_task,
          :show_feed,
          :show_buyer,
          :show_finance,
          :show_remark,
          :show_completed,
          :order_item_feeds,
          :sales_contract,
          :help_for_first_order_step_2_3_4_5_6,
          :reset_feeds_position,
          :new_task,
          :close_can_see
          
      put :update_buyer,
          :update_remark,
          :update_order_item,
          :update_installed,
          :update_install_unfinished,
          :update_installation,
          :update_order_made,
          :update_after_serviced,
          :update_after_service_finished,
          :update_after_service_unfinished,
          :update_enter,
          :update_finance,
          :update_completed,
          :update_task,
          :update_payment,
          :create_completed,
          :being_edited,
          :blanked_out,
          :effected,
          :filed,
          :update_visible
      post :create_order_item,
            :create_order_made,
            :create_installation,
            :create_install_unfinished,
            :create_after_serviced,
            :create_after_service_finished,
            :create_after_service_unfinished,
            :create_enter,
            :create_payment,
            :create_installed,
            :create_task
      delete :destroy_installation,
              :destroy_after_service,
              :destroy_order_made,
              :destroy_enter,
              :destroy_payment,
              :destroy_completed,
              :destroy_task;
    end
    collection do
      get :autocomplete_order_info,
        :autocomplete_furniture_code,
        :autocomplete_furniture_name,
        :help_for_first_order_step_1,
        :tasks,
        :xxed_on,
        :month_stat_chart_for_delivered_on,
        :month_stat_chart_for_overdue_delivered_on,
        :month_stat_chart_for_installed_on,
        :month_stat_chart_for_after_serviced_on,
        :month_stat_chart_for_order_made_on,
        :month_stat_chart_for_payed_on,
        :month_stat_chart_for_entered_on,
        :month_stat_chart_for_ordered_on,
        :month_stat_chart_for_filed_on,
        :month_stat_chart_for_blanked_out_on
    end
  end
  
  resources :tasks do
    member do
      put :completed,
        :waiting
    end
  end
  
  resources :sessions do 
  end
  
  resources :users do
    member do
      get :edit_enterprise,
        :show_enterprise,
        :edit_password,
        :show_password,        
        :new_employee,
        :new_group,
        :edit_employee,
        :edit_group
      put :update_enterprise,
        :update_password,
        :update_employee,
        :update_group,
        :lock_employee,
        :active_employee,
        :reset_employee_password,
        :update_feed_view_type
      delete :destroy_group
    end
    collection do 
      post :create_employee,
            :create_group
      get :employees,
          :groups
    end
  end

  resources :ppts do

  end

  resources :oauths do
  end

  match 'oauth/callback' => 'oauths#callback'
  match 'oauth/token' => 'oauths#token'
  # See how all your routes lay out with "rake routes"

  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  # match ':controller(/:action(/:id(.:format)))'
end
